package com.ayoka.parenting.adapter;

import android.widget.ImageView;

import com.ayoka.parenting.R;
import com.ayoka.parenting.bean.ClassroomBean;
import com.jincp.common.brvah.BaseQuickAdapter;
import com.jincp.common.brvah.BaseViewHolder;
import com.jincp.common.utils.DateUtil;
import com.jincp.common.utils.StringUtil;
import com.jincp.image.load.ImageLoader;
import com.jincp.image.load.ImageLoaderOptions;

/**
 * Created by jinchunping on 2018/4/11.
 */

public class AllGrownClassroomAdapter extends BaseQuickAdapter<ClassroomBean, BaseViewHolder> {

    public AllGrownClassroomAdapter() {
        super(R.layout.item_all_grown_classroom);
    }

    @Override
    protected void convert(BaseViewHolder holder, final ClassroomBean item) {
        if (item.LecturerInfo != null) {
            ImageLoader.getInstance().displayImage(item.LecturerInfo.CoachAvatar, (ImageView) holder.getView(R.id.iv_coach_header), ImageLoaderOptions.getRoundOptions());
            holder.setText(R.id.tv_coach_name, item.LecturerInfo.CoachName);
        }
        holder.setText(R.id.tv_classroom_name, item.Title)
                .setText(R.id.tv_start_date, StringUtil.formatString(R.string.format_start_date, DateUtil.get10Date(item.StartDate)))
                .setText(R.id.tv_start_time, StringUtil.formatString(R.string.format_start_time, StringUtil.formatString("%02d:%02d", item.Hour, item.Min)))
                .setText(R.id.tv_start_node, StringUtil.formatString(R.string.format_start_node, item.getStartNode()))
                .addOnClickListener(R.id.btn_check_detail);
    }
}